<?php

namespace App;

use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Zizaco\Entrust\Traits\EntrustUserTrait;
use Validator;


class Admin extends Authenticatable
{
    use Notifiable;
	use EntrustUserTrait;

    protected $table = 'admin';
    protected $primaryKey = 'id';
	
	
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'username', 'mobile', 'password',
    ];

    /**
     * The attributes that should be hidden for arrays.
     *
     * @var array
     */
    protected $hidden = [
        'password', 
    ];
	
	
	public function check($input){
        $validator = Validator::make($input, [
            'username' => 'required',
            'password' => 'required|same:confirm_password',
            'confirm_password' => 'required',
            'role_id' => 'required',
        ]);			
        if ($validator->fails()) {
            return $validator->errors()->first();
        }
		return 0;	
	}
	
	
}
